﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;

namespace DirectX_CS
{
	public partial class RenderStateViewer : Form, INamed
	{
		protected string shortName = "RenderState";
		[PGBrowsable]
		public string ShortName
		{
			get { return shortName; }
			set { shortName = value; }
		}
		private int shortNumber = 0;

		public int ShortNumber
		{
			get { return shortNumber; }
			set { shortNumber = value; }
		}
		[PGBrowsable]
		public string ObjectName
		{
			get { return shortName + " " + shortNumber; }
		}

		public RenderStateViewer()
		{
			Device directXDevice = MainProgram.DxDevice;
			InitializeComponent();
			pgRenderState.SelectedObject = directXDevice.RenderState;
			pgDevice.SelectedObject = directXDevice;
			onlyForm = this;
		}
		private static RenderStateViewer onlyForm = null;

		public static RenderStateViewer OnlyForm
		{
			get
			{
				if (onlyForm == null)
				{
					onlyForm = new RenderStateViewer();
				}
				return onlyForm;
			}
			set { RenderStateViewer.onlyForm = value; }
		}

		private void RenderStateViewer_FormClosing(object sender, FormClosingEventArgs e)
		{
			if (e.CloseReason == CloseReason.UserClosing)
				e.Cancel = true;
			this.Hide();
		}

	}
}
